﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace CIT.WMS
{
    public partial class FrmMain : Form
    {
        public FrmMain()
        {
            InitializeComponent();
            try
            {
                string ip = Utils.IPaddress();
                //Utils.NMS.Url = "http://" + ip + "/NMS.svc";

            }
            catch
            {
                //Utils.NMS.Url = "http://192.168.0.88:10000/NMS.svc";
            }
            //BarcodeUtils obj = new BarcodeUtils();
            //BarcodeUtils.BarObject sss5 = obj.AnalysisBarcode(@"http://174.36.249.85:10001/uaes/cq?barcode=[)>@06@12S0002@P8905708027@1PSP000757916@31PSP000757916@12V341137102@10VAUT-CHN@2P@20P@6D20170313@14D20190319@30PY@Z01@K55012403/001@16K4025367319@V84069@3SS000001484609@Q3000NAR000@20T1@1TVC6490852I7@2T@1Z@@");

            //MessageBox.Show(Utils.NMS.Url);
            //this.WindowState = FormWindowState.Maximized;
            //Utils.NMS.Url = "http://172.16.217.131:10000/NMS.svc";
        }

        private void FrmMain_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.Close();
            }
        }


        public delegate void DoThingDelegate();
        private void FrmMain_Load(object sender, EventArgs e)
        {

            contect();
        }

        void contect()
        {
            try
            {
                Utils.NMS.QueryDataTable(Utils.uContext, "select top 10  * from sysdatuser where 1<>1", new CIT.WMS.MESWcf.CmdParameter[0]);
            }
            catch
            {
                MessageBox.Show("服务器连接失败.");
                this.Close();
            }
        }

        private void btn_house_Click(object sender, EventArgs e)
        {
            FrmCheckUser f_user = new FrmCheckUser();
            f_user.ShowDialog();
            if (f_user.flag)
            {
                houseWork.FrmHouse f_house = new CIT.WMS.houseWork.FrmHouse();
                f_house.ShowDialog();
            }
        }



        private void btn_RK_Click(object sender, EventArgs e)
        {
            //CIT.WMS.input.CGInput f = new CIT.WMS.input.CGInput();
            //f.ShowDialog();
            FrmCheckUser frm = new FrmCheckUser();
            frm.ShowDialog();
            if (frm.flag)
            {
                CIT.WMS.input.LL_RK f = new CIT.WMS.input.LL_RK();
                f.ShowDialog();
            }
        }



        private void btn_BL_Click(object sender, EventArgs e)
        {
            FrmCheckUser f_user = new FrmCheckUser();
            f_user.ShowDialog();
            if (f_user.flag)
            {
                Move.FrmPrepareManage f = new Move.FrmPrepareManage();
                f.ShowDialog();
            }
        }

        private void btn_pro_Click(object sender, EventArgs e)
        {
            CIT.WMS.Product.FrmProductMain fpm = new CIT.WMS.Product.FrmProductMain();
            fpm.ShowDialog();
        }

        private void btn_deli_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Utils.uContext.UserIDk__BackingField))
            {
                FrmCheckUser f_user = new FrmCheckUser();
                f_user.ShowDialog();
                if (f_user.flag)
                {
                    Delivery.DeliveryConfirm dc = new Delivery.DeliveryConfirm();
                    dc.ShowDialog();
                }
            }
            else
            {
                Delivery.DeliveryConfirm dc = new Delivery.DeliveryConfirm();
                dc.ShowDialog();
            }

        }

        private void btn_stor_Click(object sender, EventArgs e)
        {
            FrmCheckUser f_user = new FrmCheckUser();
            f_user.ShowDialog();
            if (f_user.flag)
            {
                Product.StorageConfirm sc = new CIT.WMS.Product.StorageConfirm();
                sc.ShowDialog();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {

            CIT.WMS.RM.FrmRMMain fpm = new CIT.WMS.RM.FrmRMMain();
            fpm.ShowDialog();
        }

        private void btn_Move_Click(object sender, EventArgs e)
        {
            CIT.WMS.TranseferRM.FrmMove frm = new CIT.WMS.TranseferRM.FrmMove();
            frm.ShowDialog();
        }

        private void btnKuweiIvt_Click(object sender, EventArgs e)
        {
            CIT.WMS.Other.FrmKuweiIvt frm = new CIT.WMS.Other.FrmKuweiIvt();
            frm.ShowDialog();
        }

        private void btn_Picking_Click(object sender, EventArgs e)
        {
            CIT.WMS.Other.FrmPicking1 frm = new CIT.WMS.Other.FrmPicking1();
            frm.ShowDialog();
        }

        private void btn_ASELabelCheck_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Utils.uContext.UserIDk__BackingField))
            {
                FrmCheckUser frm = new FrmCheckUser();
                frm.ShowDialog();
                if (frm.flag)
                {
                    CIT.WMS.Other.FrmASELabelCheck f = new CIT.WMS.Other.FrmASELabelCheck();
                    f.ShowDialog();
                }
            }
            else
            {
                CIT.WMS.Other.FrmASELabelCheck f = new CIT.WMS.Other.FrmASELabelCheck();
                f.ShowDialog();
            }
        }

        private void btnTPrint_Click(object sender, EventArgs e)
        {
            
            if (string.IsNullOrEmpty(Utils.uContext.UserIDk__BackingField))
            {
                FrmCheckUser f_user = new FrmCheckUser();
                f_user.ShowDialog();
                if (f_user.flag)
                {
                    Product.FrmTPrint sc = new CIT.WMS.Product.FrmTPrint();
                    sc.ShowDialog();
                }
            }
            else
            {
                Product.FrmTPrint sc = new CIT.WMS.Product.FrmTPrint();
                sc.ShowDialog();
            }
        }

        private void btnTCheck_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Utils.uContext.UserIDk__BackingField))
            {
                FrmCheckUser f_user = new FrmCheckUser();
                f_user.ShowDialog();
                if (f_user.flag)
                {
                    Product.FrmTCheck sc = new CIT.WMS.Product.FrmTCheck();
                    sc.ShowDialog();
                }
            }
            else
            {
                Product.FrmTCheck sc = new CIT.WMS.Product.FrmTCheck();
                sc.ShowDialog();
            }
        }

        private void btnFordLabelCheck_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Utils.uContext.UserIDk__BackingField))
            {
                FrmCheckUser f_user = new FrmCheckUser();
                f_user.ShowDialog();
                if (f_user.flag)
                {
                    Other.FrmFordBarCodeCheck f = new  CIT.WMS.Other.FrmFordBarCodeCheck();
                }
            }
            else
            {
                Other.FrmFordBarCodeCheck f = new CIT.WMS.Other.FrmFordBarCodeCheck();
                f.ShowDialog();
            }
        }

        private void btnFordBillCheck_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Utils.uContext.UserIDk__BackingField))
            {
                FrmCheckUser f_user = new FrmCheckUser();
                f_user.ShowDialog();
                if (f_user.flag)
                {
                    Other.FrmFordBillCheck f = new CIT.WMS.Other.FrmFordBillCheck();
                }
            }
            else
            {
                Other.FrmFordBillCheck f = new CIT.WMS.Other.FrmFordBillCheck();
                f.ShowDialog();
            }
        }

        private void btnFordBoxCheck_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Utils.uContext.UserIDk__BackingField))
            {
                FrmCheckUser f_user = new FrmCheckUser();
                f_user.ShowDialog();
                if (f_user.flag)
                {
                    Other.FrmFordBoxCheck f = new CIT.WMS.Other.FrmFordBoxCheck();
                }
            }
            else
            {
                Other.FrmFordBoxCheck f = new CIT.WMS.Other.FrmFordBoxCheck();
                f.ShowDialog();
            }
        }

        private void btnLabelMenu_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Utils.uContext.UserIDk__BackingField))
            {
                FrmCheckUser f_user = new FrmCheckUser();
                f_user.ShowDialog();
                if (f_user.flag)
                {
                    FrmLabel f = new FrmLabel();
                }
            }
            else
            {
                FrmLabel f = new FrmLabel();
                f.ShowDialog();
            }
        }
    }
}